import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
import { getToken } from '@/api/login'

export default new Vuex.Store({
  state: {
    token:''||getToken(),
    userinfo:{}
  },
  getters: {
  },
  mutations: {
    settoken(state,pay){
      state.token=pay
          },
    setuserinfo(state,pay){
state.userinfo=pay
    }
  },
  actions: {
    settoken(context,pay){
     // console.log(pay);
context.commit('settoken',pay)
    },
//存储用户信息
    setuserinfo(context,pay){
context.commit('setuserinfo',pay)
//console.log(pay);
    }
  },
  modules: {
  }
})
